<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>手机商城</title>
<!-- CSS -->
<link rel="stylesheet" href="{url:#css/materialize.min.css}" />
<link rel="stylesheet" href="{url:#css/me.css}" />
<link rel="stylesheet" href="{url:#css/iconfont.css}" />

<style type="text/css">
/**去除绿色下划线 - 开始*/
input::-webkit-input-placeholder {
    color: #7e7e7e;
    text-indent: 5px;
}
input:not([type]),input[type=text],input[type=password],input[type=email],input[type=url],input[type=time],input[type=date],input[type=datetime-local],input[type=tel],input[type=number],input[type=search],textarea.materialize-textarea{background-color:transparent;border:none;border-radius:0;outline:none;height:1.5em;width:100%;font-size:1rem;margin:0;padding:0;box-shadow:none;}
input:not([type]):focus:not([readonly]),input[type=text]:focus:not([readonly]),input[type=password]:focus:not([readonly]),input[type=email]:focus:not([readonly]),input[type=url]:focus:not([readonly]),input[type=time]:focus:not([readonly]),input[type=date]:focus:not([readonly]),input[type=datetime-local]:focus:not([readonly]),input[type=tel]:focus:not([readonly]),input[type=number]:focus:not([readonly]),input[type=search]:focus:not([readonly]),textarea.materialize-textarea:focus:not([readonly]){border-bottom:none;box-shadow:none}
/**去除绿色下划线 - 结束*/
</style>
<!-- JS -->
<script src="{url:#js/jquery-1.11.3.min.js}"></script>
<script src="{url:#js/materialize.min.js}"></script>
<script src="{url:#js/home/register.js}"></script>
<script src="{url:#js/yang_check.js}"></script>


</head>
<body class="q-body">
<!-- TitleBar 开始 -->
<div class="navbar-fixed">
  <nav>
    <div class="nav-wrapper red accent-4 valign-wrapper">
      <ul class="left" id="nav-btn-left" onclick="document.location.href='{url:/mobile/user_center}'">
        <li><a><i class="iconfont">&#xe63c;</i></a></li>
      </ul>
      <span class="title-bar-size center_align">提现</span>
      <ul class="right">
        <li><a  class="disabled" style="visibility:hidden"><i class="iconfont">&#xe63c;</i></a></li>
      </ul>
    </div>
  </nav>
</div>
<!-- TitleBar 结束 -->

<div class="container">
	 <div class="q-reg-box">
	    <table>
	    <tr>
			<td class="q-ltitle">账户余额：</td>
			<td><span>￥<b style="font-size:18px;color:red;">{$mobile_user['balance']}</b></span></td>
		</tr>
		<tr>
			<td class="q-ltitle">提现金额：</td>
			<td><input type="text" id="amount" name='amount' style="border:1px solid #ccc;padding:10px; margin-left:-10px;"/></td>
		</tr>
		<tr>
			<td class="q-ltitle">真实姓名：</td>
			<td><input type="text" disabled id="name" name='name' value="{$mobile_user['real_name']}" style="border:1px solid #ccc;padding:10px; margin-left:-10px;"/></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>
				<span> 	真实姓名不可编辑，若为空，请到PC端个人信息中心完善资料</span>
			</td>
		</tr>
        <tr>
			<td class="q-ltitle">开户银行地址：</td>
			<td><input type="text" id="type_name" name="type_name" value="{$mobile_user['bank']}" style="border:1px solid #ccc;padding:10px; margin-left:-10px;"/></td>
		</tr>
		<tr>
			<td class="q-ltitle">银行卡号：</td>
			<td><input type="text" id="account" name="account" value="{$mobile_user['bank_kh']}" style="border:1px solid #ccc;padding:10px; margin-left:-10px;"/></td>
		</tr>
        <tr>
			<td class="q-ltitle">交易密码：</td>
			<td><input type="password" id="pass2" name="pass2" style="border:1px solid #ccc;padding:10px; margin-left:-10px;"/></td>
		</tr>
        
	 </table>
	</div>
	<div class="center clearfix" style="margin-right:10px; margin-left:10px;margin-top:10px;margin-bottom:50px;">
		<input type="hidden" id="user_id" name="user_id" value="{$mobile_user['id']}"/>
		<input type="hidden" id="balance" name="balance" value="{$mobile_user['balance']}"/>
		<!-- 
		<a class="waves-effect waves-light btn-large red z-depth-0 login_btn" id="a_sub" onclick="sub_withdraw()">申请提现</a>
		-->
		<input type="button" onclick="sub_withdraw()" class="waves-effect waves-light btn-large red z-depth-0 login_btn" id="a_sub" value="申请提现"/>
	</div>
</div>

<script type="text/javascript">
function show_msg( msg )
{
	yang_alert( msg );
	return false;
}
function sub_withdraw()
{
	var amount    = $("#amount").val();
	var name      = $("#name").val();
	var type_name = $("#type_name").val();
	var account   = $("#account").val();
	var pass2     = $("#pass2").val();
	
	var balance   = parseFloat( $("#balance").val() );
	var user_id   = $("#user_id").val();
	
	if(amount=='' || isNaN( amount ) || amount < 100 || amount%10 != 0 )
	{
		yang_alert('提现金额必须必须大于等于100且为10的倍数');
		return;
	}
	
	if( amount > balance )
	{
		yang_alert('账户余额不足');
		return;
	}

	if(name == '')
	{
		return show_msg('姓名不能为空');
	}

	if(type_name == '')
	{
		return show_msg('金融机构不能为空');
	}
			  
	if(account == '')
	{
		return show_msg('金融账号不能为空');
	}

	if(pass2 == '')
	{
		return show_msg('二级密码不能为空');
	}

	//$("#a_sub").removeAttr("onclick");
	$("#a_sub").attr('disabled', true);
	$.post('{url:/mobile/withdraw_do}',{user_id:user_id,amount:amount,name:name,account:account,type_name:type_name,pass2:pass2},function(data){
        if( data['status']=='success' )
	    {
		    yang_alert('提现申请已提交成功，请等待管理员审核');
		    //个人中心页面
            document.location.href="{url:/mobile/withdraw}";
            
        }
        else
	    {
            yang_alert(data['msg']);
            $("#a_sub").attr('disabled', false);
            //document.location.href="{url:/mobile/withdraw}";
        }
      },'json');

	
	
}
</script>

</body>
</html>
